<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>二手车求购信息</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="css/usedcar.css">

		<script type="text/javascript">
			function myUsedCarBuyInfo(){
				var eauser = "${session.eauser}";
				if(eauser == ""){
					alert("请先登录!");
					return;
				}
				else{
					window.location = "usedcar/viewBuyUsedCar_showMyUsedCarBuy";
				}
					
			}
			
			function isLoad(){
				var eauser = "${session.eauser}";
				if(eauser == ""){
					alert("请先登录!");
					return;
				}
				else{
					window.location = "mok/usedcar/addBuyUsedCar.jsp";
				}
			}
		</script>

	</head>

	<body>
		<div id="main">
			<div style="position: relative;">
				<a target="content" href="javascript:void(0)" onclick="isLoad()"
					class="button_sale" rel="nofollow" style="top: 70"></a>
			</div>
			<div class="div_top">
				<dl class="secitem">
					<dt class="secitem_brand">
						区域：
					</dt>
					<dd>
						<c:choose>
							<c:when test="${request.isAddress == 0}"><a href="javascript:void(0)" style="color: red;">不限</a></c:when>
							<c:otherwise><a href="usedcar/viewBuyUsedCar_show?price=${price1}">不限</a></c:otherwise>
						</c:choose>
						<s:iterator value="#request.carBuyAddress" var="address">
						<c:choose>
							<c:when test="${address == address1}">
									<a href="javascript:void(0)" style="color: red;"><s:property value="#address" /> </a>
								</c:when>
								<c:otherwise>
									<a href="usedcar/viewBuyUsedCar_show?address=${address}&price=${price1}"><s:property value="#address" /> </a>
								</c:otherwise>
							</c:choose>
						</s:iterator>
					</dd>
				</dl>
				<dl class="secitem">
					<dt class="secitem_brand">
						价格：
					</dt>
					<dd>
						<c:choose>
							<c:when test="${request.isPrice == 0}"><a href="javascript:void(0)" style="color: red;">不限</a></c:when>
							<c:otherwise><a href="usedcar/viewBuyUsedCar_show?address=${address1}">不限</a></c:otherwise>
						</c:choose>
						<s:iterator value="#request.priceList" var="price">
							<c:choose> 
								<c:when test="${price == price1}">
									<a href="javascript:void(0)" style="color: red;"><s:property value="#price" /> </a>
								</c:when>
								<c:otherwise>
									<a href="usedcar/viewBuyUsedCar_show?address=${address1}&price=${price}"><s:property value="#price" /> </a>
								</c:otherwise>
							</c:choose>
						</s:iterator>
					</dd>
				</dl>
			</div>
			<a href="javascript:void(0)" style="font-size: 18px;font-weight: bold;" onclick="myUsedCarBuyInfo();">我发布的求购信息</a>
			<br />
			<br />
			<table class="tbimg" cellpadding="0" cellspacing="0">
				<s:iterator value="#request.usedCarBuyList" var="usedCar">
					<tr onmouseover="this.style.background='#FFE4D2'"
						onmouseout="this.style.background='#FFF'">
						<td class="t" style="height: 40px;">
							<a href="usedcar/viewBuyUsedCar_showBuyInfo?id=${usedCar.id}" target="_blank" class="t" style="font-size: 14px;"><s:property
									value="#usedCar.title" /> </a>
							<s:property value="#usedCar.address" />
						</td>
						<td class="tc" style="text-align: right;">
							<b class='t' style="margin-right: 100px;"><center><s:property value="#usedCar.releaseTime"/></center></b>
						</td>
					</tr>
				</s:iterator>
			</table>
			<br />
			<div class="pager mb10">
				<a href="usedcar/viewBuyUsedCar_show?address=${address1}&price=${price1}&no=1"><span>首页</span></a>
				<c:if test="${requestScope.pageNoBuy != 1}">
					<a class="prv" 
						href="usedcar/viewBuyUsedCar_show?address=${address1}&price=${price1}&no=${requestScope.pageNoBuy-1}"><span>上一页</span></a>
				</c:if>
				<c:forEach var="i" begin="${requestScope.pageNoCenterBuy -2}"
					end="${requestScope.pageNoCenterBuy + 2}">
					<c:if test="${i <= requestScope.totalNoBuy }">
						<c:choose>
							<c:when test="${i == requestScope.pageNoBuy}">
								<a href="javascript:void(0)"><strong><span>${i}</span></strong></a>
							</c:when>
							<c:otherwise>
								<a href="usedcar/viewBuyUsedCar_show?address=${address1}&price=${price1}&no=${i}"><span>${i}</span></a>
							</c:otherwise>
						</c:choose>
					</c:if>
				</c:forEach>
				<c:if test="${requestScope.pageNoBuy +4 < requestScope.totalNoBuy}">
					<a class="next"
						href="usedcar/viewBuyUsedCar_show?address=${address1}&price=${price1}&no=${requestScope.pageNoBuy+1}"><span>下一页</span></a>
				</c:if>
				<a href="usedcar/viewBuyUsedCar_show?address=${address1}&price=${price1}&no=${requestScope.totalNoBuy}"><span>末页</span></a>
				&nbsp;&nbsp;&nbsp;&nbsp;共有
				<label style="color: red;">
					${requestScope.totalBuy}
				</label>
				条信息
			</div>
		</div>
	</body>
</html>
